//
// Created by YueChuan on 2023/3/19.
//
#include "sqlModule.h"
#include <QDebug>
#include <QSqlError>
void selectForm(QSqlQuery *query, const QString &selectStr, int column) {
    bool oko = query->prepare(selectStr);
    if (oko) {
        oko = query->exec();
        if (oko) {
            if (query->size() <= 0) {
                qDebug() << "select error in query->size <=0";
            } else {
                return;
            }
        } else {
            qDebug() << "select error in query->exec() " << query->lastError();
            }
    } else {
        qDebug() << "select error in query->prepare() " <<query->lastError();
    }

}

bool updateForm(QSqlQuery *query, const QString &updateStr) {
    bool oko = query->prepare(updateStr);
    if (oko) {
        oko = query->exec();
            if (oko) {
                return true;
            } else {
                 qDebug() << " update error in query->exec() " << query->lastError();
            }
    } else {
        qDebug() << " update error in query->prepare() " << query->lastError();
    }
}

